from django.contrib import admin
from blog.models import Article, Comment

# Register your models here.


class CommentInline(admin.TabularInline):
    model = Comment
    extra = 1


class CommentReplyInline(admin.TabularInline):
    model = Comment
    extra = 1

#


class CommentAdmin(admin.ModelAdmin):
    model = Comment
#     inlines = [CommentReplyInline, ]


class ArticleAdmin(admin.ModelAdmin):
    # 把Comment内置到Article里面
    inlines = [CommentInline, ]
    search_fields = ["title"]
    ordering = ["dateTime"]

#     class Media:
#         css = {
#             "all": ("blog/css/Article.css",),
#         }
#         js = ("blog/js/Article.js",
#               "http://libs.baidu.com/jquery/1.10.2/jquery.min.js")

admin.site.register(Comment, CommentAdmin)
admin.site.register(Article, ArticleAdmin)
# admin.site.register(CommentReply, CommentReplyAdmin)
